package com.itheima.homework;

import java.io.FileWriter;
import java.util.ArrayList;
import java.util.List;

public class demo05 {
    public static void main(String[] args) {
        List<Student> stuList = new ArrayList<>();
        stuList.add(new Student("张三","男","20","88"));
        stuList.add(new Student("李四","女","19","99"));

        try(FileWriter fs = new FileWriter("student.txt")){
            for (Student s : stuList) {
                fs.write(s.getName()+","+s.getSex()+","+s.getAge()
                        +","+s.getScore() + System.lineSeparator());
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
